package com.example.bookdemo.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@AllArgsConstructor
public enum GetStatusCN {
    DELETED(0,"无效"),
    NORMAL(1,"可借阅"),
    FORBIDDEN(2,"不可借阅"),
    ;

    @Getter
    private int code;
    @Getter
    private String name;

    public static GetStatusCN getNameByCode(int code){
        return Arrays.stream(GetStatusCN.values()).filter(x -> x.getCode()==code).findFirst().orElse(null);
    }
}
